{% extends "base.html" %}

{% load static %}

{% block title %}debug{% endblock %}

{% block content-title %}debug{% endblock %}

{% block nav1 %}主页{% endblock %}

{% block nav2 %}debug{% endblock %}

{% block css %}
    <link rel="stylesheet" type="text/css" href="{% static 'css/zTreeStyle.css' %}">
    <link rel="stylesheet" type="text/css" href="{% static 'css/icon.css' %}">
    <link rel="stylesheet" type="text/css" href="{% static 'css/easyui.css' %}">
    <link rel="stylesheet" type="text/css" href="{% static 'css/style.css' %}">
{% endblock %}

{% block content %}
    <div class="container-fluid">
        <nav class="navbar navbar-default" role="navigation">
            <div class="container-fluid">
                <div class="navbar-header">
                    <div class="container-fluid">
                        <ul class="nav navbar-nav">
                            <li class="dropdown">
                                <a href="#" onclick="download_apk()" class="dropdown-toggle" data-toggle="dropdown"
                                   role="button" aria-haspopup="true" aria-expanded="false"><i
                                        class="glyphicon glyphicon-download-alt" aria-hidden="true"></i> Download App
                                </a>
                                {#                                <ul class="dropdown-menu">#}
                                {#                                    <li>#}
                                {#                                     <a href="#" onclick="download_apk();">#}
                                {#                                        <i class="fa fa-android" aria-hidden="true"></i> APK#}
                                {#                                    </a>#}
                                {#                                    </li>#}
                                {#                                    <li>#}
                                {#                                        <a href="#" onclick="download_all();">#}
                                {#                                            <i class="glyphicon glyphicon-file" aria-hidden="true"></i> All Files#}
                                {#                                        </a>#}
                                {#                                    </li>#}
                                {#                                </ul>#}
                            </li>

                        </ul>
                        <form class="navbar-form navbar-left" role="search">
                            <button type="button" onclick="screenshot();" class="btn btn-default" data-toggle="tooltip"
                                    title="Screenshot">

                                <i class="glyphicon glyphicon-camera" aria-hidden="true"></i>

                            </button>

                            <button type="button" class="btn btn-default" data-toggle="modal" data-target="#myModal"
                                    data-toggle="tooltip" title="Settings">
                                <i class="glyphicon glyphicon-wrench" aria-hidden="true"></i>
                            </button>

                        </form>
                    </div>
                </div>
                <button type="button" onclick="detachall()" class="btn btn-default navbar-btn"><i
                        class="glyphicon glyphicon-remove" aria-hidden="true" title="Detach All"></i></button>
                {#            <ul class="nav navbar-nav navbar-right">#}
                {#                <li><a href="#"><span class="glyphicon glyphicon-user"></span> 注册</a></li>#}
                {#                <li><a href="#"><span class="glyphicon glyphicon-log-in"></span> 登录</a></li>#}
                {#            </ul>#}
            </div>
        </nav>
    </div>

    <hr>
    <div class="root card card-primary card-tabs">
        <div class="card-header">
            <ul class="nav nav-tabs ">
                <li class="pt-2 px-3"><h3 class="card-title">调试模式</h3></li>
                <li class="nav-item">
                    <a class="nav-link active" data-toggle="tab" href="#home"><i class="glyphicon glyphicon-home"
                                                         style="color: #337ab7"></i> Home</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link " data-toggle="tab" href="#hook"><i class="glyphicon glyphicon-th-large"
                                                         style="color: #337ab7"></i>
                        Hooks</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link " data-toggle="tab" href="#stack"><i class="glyphicon glyphicon-oil"
                                                          style="color: #337ab7"></i> Stack</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link " data-toggle="tab" href="#find"><i class="glyphicon glyphicon-search"
                                                         style="color: #337ab7"></i>
                        Finds</a></li>
                <li class="nav-item">
                    <a class="nav-link " data-toggle="tab" href="#uidump"><i class="glyphicon glyphicon-eye-open"
                                                           style="color: #337ab7"></i>
                        UIDump</a></li>
                <li class="nav-item">
                    <a class="nav-link " data-toggle="tab" href="#toBurp"><i class="glyphicon glyphicon-th"
                                                           style="color: #337ab7"></i> toBurp</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link " data-toggle="tab" href="#Custom"><i class="glyphicon glyphicon-user"
                                                           style="color: #337ab7"></i>
                        Custom</a></li>
                <li class="nav-item">
                    <a class="nav-link " data-toggle="tab" href="#Decoder"><i class="glyphicon glyphicon-transfer"
                                                            style="color: #337ab7"></i>
                        Decoder</a></li>
            </ul>
        </div>
        <div class="tab-content">
            <div class="tab-pane fade in active" id="home">
                <p>Package: <code id="pkg"></code></p>
                <div>
                    <input id="pkgnametext" type="text" class="form-control" placeholder="packagename"
                           style="width: 250px;display: inline-block">
                    <button type="submit" id="pkgname" class="btn btn-success "
                            style="width: 90px;height: 32px;margin-bottom: 2px">Confirm
                    </button>
                </div>
                <div class="table-responsive col-sm-8 pre-scrollable"
                     style="max-height: 600px;padding-left: 0px;padding-right: 0px; margin-top: 5px;">
                    <table class="table table-striped table-bordered" style="table-layout:fixed;word-break:break-all;">
                        <thead>
                        <tr>
                            <th style="width: 25%">PackageName</th>
                            <th style="width: 25%">ApplicationName</th>
                            <th style="width: 10%">pid</th>
                        </tr>
                        </thead>
                        <tbody id="outputappname"></tbody>
                    </table>
                </div>
            </div>
            <div class="tab-pane fade form-group" id="hook">
                <p id="toggle_hooks_info" class="text-primary"
                   style="cursor: pointer; margin-bottom: 3px;display: inline-block;">Hooks <i
                        class="glyphicon glyphicon-resize-small"></i></p>&nbsp;&nbsp;
                <div class="btn-group" role="group" aria-label="...">
                    <button type="button" id="loadScript" class="btn btn-default btn-xs">Confirm</button>
                    <!--<button type="button" class="btn btn-warning btn-xs" onclick="unloadScript()">UnLoadScript</button>-->
                </div>
                <div class="well" id="hooks-info-div">
                    <div class="row ">
                        <div class="col-sm-6">
                            <label>Match <span
                                    title="Hooks 是将给定的类名下的所有方法都Hook一遍。&#10;可填写完整类名，填写类名中包含的一部分字符串也可以匹配到你想要的类，多个类换行分隔。支持正则(JavaScript match) &#10;例如: 完整类名com.lxh.xxx.class1 可以写成 com.lxh or lxh.xxx or xxx or... 写成com.lxh,会把所有包含这个字符的类名都匹配上，然后把类下面的所有方法都Hook了, 为空Hook所有方法（会导致APP崩溃）"><i
                                    class="glyphicon glyphicon-question-sign"></i></span></label>
                            <div id="HooksMatchcode" style="height: 250px"></div>
                            <!--<input type="text" id="matchtext" class="form-control" placeholder="hook class" style="width: 250px;display: inline-block">-->
                            <!--<button type="submit" id="loadScript" class="btn btn-success " style="width: 90px;height: 32px;margin-bottom: 2px">Confirm</button>-->
                        </div>
                        <div class="col-sm-6">
                            <label>Options <span title="填写方法名称,多个换行分隔。ex. +[MyClass sleep::] 填写sleep "><i
                                    class="glyphicon glyphicon-question-sign"></i></span></label>
                            <div id="HooksOptionscode" style="height: 250px"></div>
                        </div>
                    </div>
                </div>
                <p style="color: #337ab7;margin: 5px 0px;"> Output Console <span
                        class="glyphicon glyphicon-remove clickable" aria-hidden="true"
                        onclick="clear_hookMessage()"></span></p>

                <div class="table-responsive pre-scrollable" style="min-height: 700px;" id="outputTbl">

                    <table class="table table-striped table-bordered" style="table-layout:fixed;word-break:break-all;">
                        <thead>
                        <tr>
                            <th style="width: 20%">MethodName</th>
                            <th style="width: 60%">Args Dump</th>
                            <th style="width: 20%">Return Value</th>
                        </tr>
                        </thead>
                        <tbody id="outputBody"></tbody>
                    </table>
                </div>

            </div>
            <div class="tab-pane fade form-group" id="toBurp">
                <p id="toggle_toburp_info" class="text-primary"
                   style="cursor: pointer; margin-bottom: 3px;display: inline-block;">toBurp <i
                        class="glyphicon glyphicon-resize-small"></i></p>&nbsp;&nbsp;
                <div class="btn-group" role="group" aria-label="...">
                    <button type="button" id="Inspect" class="btn btn-default btn-xs">Confirm</button>
                    <!--<button type="button" class="btn btn-warning btn-xs" onclick="unloadScript()">UnLoadScript</button>-->
                </div>
                <div class="well" id="toburp-info-div">
                    <div class="row">
                        <div id="methodinput" class="col-sm-6">
                            <label>Input</label>
                            <div>
                                <input type="text" id="InspectText" class="form-control"
                                       placeholder="PackageName.ClassName.MethodName">
                                <!--<input type="text" id="InspectText" class="form-control" placeholder="PackageName.ClassName.MethodName" style="width: 300px;display: inline-block">-->
                                <!--<input id="Inspect" class="btn btn-success" value="Confirm" style="width: 90px;height: 32px;margin-bottom: 2px">-->
                            </div>
                            <label>Info: </label>
                            <div id="infomessage" style="height: 122px"></div>
                            <!--<textarea class="form-control" rows="3" id="infomessage"></textarea>-->
                        </div>
                        <div class="col-sm-6">
                            <div id="input_reuslt"></div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-12">
                        <p style="color: #337ab7;margin: 5px 0px;"> Output Console <span
                                class="glyphicon glyphicon-remove clickable" aria-hidden="true"
                                onclick="clear_doburp_hookMessage()"></span></p>
                        <div class="table-responsive pre-scrollable" style="min-height: 500px;">
                            <table class="table table-striped table-bordered"
                                   style="table-layout:fixed;word-break:break-all;">
                                <thead>
                                <tr>
                                    <th style="width: 90%">Info</th>
                                    <!--<th style="width: 60%">Args Dump</th>-->
                                    <th style="width: 10%">Call</th>
                                </tr>
                                </thead>
                                <tbody id="toburpoutputBody">
                                <!--<tr>-->
                                <!--<td>123</td>-->
                                <!--<td>789</td>-->
                                <!--</tr>-->
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
            <div class="tab-pane fade form-group" id="stack">
                <div class="table-responsive pre-scrollable" style="min-height: 700px;" id="stackoutputTb">
                    <p style="color: #337ab7;margin: 5px 0px;"> Output Console <span
                            class="glyphicon glyphicon-remove clickable" aria-hidden="true"
                            onclick="clear_stackMessage()"></span></p>
                    <table class="table table-striped table-bordered" style="table-layout:fixed;word-break:break-all;">
                        <thead>
                        <tr>
                            <th style="width: 30%">MethodName</th>
                            <th style="width: 70%">Stack</th>
                        </tr>
                        </thead>
                        <tbody id="stackoutputBody"></tbody>
                    </table>
                </div>
            </div>
            <div class="tab-pane fade form-group" id="find">
                <p id="toggle_find_info" class="text-primary"
                   style="cursor: pointer; margin-bottom: 3px;display: inline-block;">Finds <i
                        class="glyphicon glyphicon-resize-small"></i></p>&nbsp;&nbsp;
                <div class="btn-group" role="group" aria-label="...">
                    <button type="button" id="loadfindScript" class="btn btn-default btn-xs">Confirm</button>
                    <button type="button" class="btn btn-warning btn-xs" onclick="unloadScript()">UnLoadScript</button>
                    <button type="button" id="Searchmethods" class="btn btn-default btn-xs">Searchmethods</button>
                    <button type="button" id="ExportAllMoudle" class="btn btn-default btn-xs">ExportAllMoudle</button>
                    <!--                <button type="button" id="EnumExportNative" class="btn btn-default btn-xs" >EnumExportsNative</button>
                                        <button type="button" id="EnumImportNative" class="btn btn-default btn-xs" >EnumImportsNative</button>
                                        <button type="button" id="EnumSymbols" class="btn btn-default btn-xs" >EnumSymbols</button> -->
                    <div class="input-group input-group-sm ">
                        <input type="text" id="keyword" style="height:21.6px;" class="form-control findsearch"
                               onkeyup="AutoMatch(this)" placeholder="Search" aria-describedby="sizing-addon3">
                    </div>
                </div>

                <span><code id="findsmethodname"></code></span>

                <div class="well" id="find-info-div">
                    <div class="row ">
                        <div class="col-sm-6 ">
                            <label>Match <span
                                    title="Finds 是将已加载的类下的所有方法打印出来，可指定类。&#10;Match使用方式与Hooks一致，支持正则，不填写Match打印所有方法。"><i
                                    class="glyphicon glyphicon-question-sign"></i></span></label>
                            <div id="FindMatchcode" style="height: 250px"></div>
                        </div>

                        <div class="col-sm-6">
                            <label>Options <span title="由于打印所有方法的时候，很多都是Android的库，因此提供了过滤功能，支持以 开头，包含，结尾的方式过滤。"><i
                                    class="glyphicon glyphicon-question-sign"></i></span></label>
                            <div id="FindOptionscode" style="height: 250px"></div>
                        </div>

                    </div>
                </div>

                <div style="min-height: 500px;">
                    <div class="left">
                        <ul id="javatree" class="ztree"></ul>
                    </div>
                    <!--style="width:200px;"-->
                    <div id="mm" class="easyui-menu">
                        <div id="Send to Hooks" data-options="name:'sendhooks'">Send to Hooks</div>
                        <!--   <div id="startsWith" data-options="name:'modify'">Add startsWith FindsOptions</div>
                          <div id="contains" data-options="name:'del'">Add contains FindsOptions</div>
                          <div id="endsWith" data-options="name:'del'">Add endsWith FindsOptions</div> -->
                    </div>

                    <div id="mm1" class="easyui-menu" style="width:250px;">
                        <div id="Send to toBurp" data-options="name:'SendtotoBurp'">Send to toBurp</div>
                        <!--<div id="delNode" data-options="name:'del'">删除节点</div>-->
                    </div>

                    <div id="ios" class="easyui-menu" style="width:120px;">
                        <div id="Send to toBurp" data-options="name:'SendtotoBurp'">Send to toBurp</div>
                        <div id="Send to Hooks" data-options="name:'sendhooks'">Send to Hooks</div>
                        <!--<div id="delNode" data-options="name:'del'">删除节点</div>-->
                    </div>

                    <div id="custom" class="easyui-menu" style="width:260px;">
                        <div id="Generate hook script" data-options="name:'Generate hook script'">Generate native hook
                            script
                        </div>
                        <div id="Generate Exportfun script" data-options="name:'Generate Exportfun scrip'">Generate
                            native
                            Exportfun script
                        </div>
                        <div id="Generate toBurp script" data-options="name:'Generate toBurp script'">Generate native
                            toBurp
                            script
                        </div>
                        <!--<div id="modifyNode" data-options="name:'modify'">修改节点</div>-->
                        <!--<div id="delNode" data-options="name:'del'">删除节点</div>-->
                    </div>
                    <div id="native" class="easyui-menu" style="width:230px;">
                        <div id="enumerateExports" data-options="name:'enumerateExports'">enumerateExports</div>
                        <div id="enumerateRegisterNatives" data-options="name:'enumerateRegisterNatives'">
                            enumerateRegisterNatives
                        </div>
                        <div id="enumerateImports" data-options="name:'enumerateImports'">enumerateImports</div>
                        <div id="enumerateSymbols" data-options="name:'enumerateSymbols'">enumerateSymbols</div>
                    </div>

                </div>
            </div>
            <div class="tab-pane fade form-group" id="Decoder">
                <p id="toggle_find_info" class="text-primary"
                   style="cursor: pointer; margin-bottom: 3px;display: inline-block;">Decoder </p>&nbsp;&nbsp;
                <select class="btn-xs" id="Decoder_select_result">
                    <option value="1">byte array and hex string interconvert</option>
                    <option value="2">byte array and string interconvert</option>
                </select>
                <div class="btn-group" role="group" aria-label="...">
                    <button type="button" id="DecoderConfirmLeft" class="btn btn-default btn-xs">---></button>
                    <button type="button" id="DecoderConfirmRight" class="btn btn-warning btn-xs" onclick=""><---
                    </button>
                </div>

                <div class="well" id="Decoder-info-div">
                    <div class="row ">
                        <div class="col-sm-6 ">
                            {#                            <label>Match </label>#}
                            <div id="DecoderLeft" style="height: 250px"></div>
                        </div>

                        <div class="col-sm-6">
                            {#                            <label>Options </label>#}
                            <div id="DecoderRight" style="height: 250px"></div>
                        </div>

                    </div>
                </div>
            </div>
            <div class="tab-pane fade form-group" id="uidump">
                <p id="toggle_find_info" class="text-primary"
                   style="cursor: pointer; margin-bottom: 3px;display: inline-block;">UIDump <i
                        class="glyphicon glyphicon-resize-small"></i></p>&nbsp;&nbsp;
                <div class="btn-group" role="group" aria-label="...">
                    <button type="button" id="loaduiScript" class="btn btn-default btn-xs">Confirm</button>
                </div>

                <div class="well">
                    <p>Activity: <code id="Activity"></code></p>
                    <p>Pid: <code id="pid"></code></p>
                    <p>Click: <code id="click"></code></p>
                    <p>Listener: <code id="listener"></code></p>
                    <p>Fragment: <code id="fragment"></code></p>
                    {#                    <p>Activity:<code id="">aaa</code></p>#}
                </div>
                {#				<div class="container-fluid" style="padding-left: 50px; padding-right: 50px;padding-top: 20px" id="">#}
                {#                    <pre style="height: 500px;">#}
                {#                        aa:<code>asd</code>#}
                {#                        aa:<code>asd</code>#}
                {#                        aa:<code>asd</code>#}
                {#                    </pre>#}
                {##}
                {#				</div>#}

            </div>
            <div class="tab-pane fade form-group" id="Custom">
                <p id="toggle_custom_info" class="text-primary"
                   style="cursor: pointer; margin-bottom: 3px;display: inline-block;">Custom <i
                        class="glyphicon glyphicon-resize-small"></i></p>&nbsp;&nbsp;
                <div class="btn-group" role="group" aria-label="...">
                    <button type="button" id="DecoderConfirmLeft" class="btn btn-default btn-xs">loadScript</button>
                    <button type="button" data-toggle="modal" data-target="#ScriptManage" id="CustomScriptManage"
                            onclick="getcustominfo();" class="btn btn-default btn-xs">ScriptManage
                    </button>
                    <button type="button" class="btn btn-warning btn-xs" onclick="savefileContent('EditCustomcode')">
                        SaveScript
                    </button>
                    <button type="button" id="DecoderConfirmRight" class="btn btn-default btn-xs" onclick="">DelScript
                    </button>
                </div>

                <!-- Modal -->
                <div class="modal fade" id="ScriptManage" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
                     data-backdrop="static" data-keyboard="false">
                    <div class="modal-dialog modal-lg" role="document">
                        <div class="modal-content">
                            <div class="modal-header">
                                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                                        aria-hidden="true">&times;</span></button>
                                <h4 class="modal-title" id="myModalLabel">Script Manage</h4>
                                <h6>Current Script Path: <code id="filepath" style="word-wrap:break-word"></code></h6>
                            </div>
                            <div class="modal-body">
                                <div class="row">
                                    <div class="col-md-3  scriptManageul" id="ScriptList">
                                        <div id="customscriptlist" class="list-group " style="word-wrap:break-word">
                                        </div>
                                    </div>

                                    <div id="ScriptManageEditorView" class="col-md-9" style="height: 500px"></div>

                                </div>
                            </div>
                            <div class="modal-footer">
                                <button type="button" class="btn btn-primary" onclick="loadfileContent()">Load this
                                    script
                                </button>
                                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                                <button type="button" class="btn btn-primary"
                                        onclick="savefileContent('EditScriptManageEditorView')">Save changes
                                </button>
                            </div>

                        </div>
                    </div>
                </div>


                <div class="well" id="Custom-info-div">
                    <div class="row ">
                        <div class="col-sm-12 ">
                            {#                            <label>Match </label>#}
                            <div id="Customcode"></div>
                        </div>
                    </div>
                </div>

                <div class="row">
                    <div class="col-sm-12">
                        <p style="color: #337ab7;margin: 5px 0px;"> Output Console <span
                                class="glyphicon glyphicon-remove clickable" aria-hidden="true"
                                onclick="clear_Custom_Message()"></span></p>
                        <div class="table-responsive pre-scrollable" style="min-height: 500px;">
                            <table class="table table-striped table-bordered"
                                   style="table-layout:fixed;word-break:break-all;">
                                <thead>
                                <tr>
                                    <th style="width: 90%">Info</th>
                                </tr>
                                </thead>
                                <tbody id="CustomOutputBody">
                                <!--<tr>-->
                                <!--<td>123</td>-->
                                <!--</tr>-->
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>

            </div>

        </div>
    </div>
{% endblock %}

{% block script %}
    <script type="text/javascript" href="{% static 'js/socket.io.js' %}"></script>
    <script type="text/javascript" href="{% static 'js/app.js' %}"></script>
    <script type="text/javascript" href="{% static 'edit-js/ace.js' %}"></script>
    <script type="text/javascript" href="{% static 'edit-js/ext-language_tools.js' %}"></script>
    <script type="text/javascript" href="{% static 'js/jquery.ztree.core.min.js' %}"></script>
    <script type="text/javascript" href="{% static 'js/jquery.ztree.exhide.min.js' %}"></script>
    <script type="text/javascript" href="{% static 'js/fuzzysearch.js' %}"></script>
    <script type="text/javascript" href="{% static 'js/jquery.easyui.min.js' %}"></script>
    <script type="text/javascript" href="{% static 'js/editortree.js' %}"></script>
    <script type="text/javascript">
        console.log('测试')
    </script>
{% endblock %}